package nl.myhealth.app.myhealthapp;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import nl.myhealth.app.myhealthapp.Adapter.Profile;


public class ProfileActivity extends ActionBarActivity {

    private TextView firstnameView;
    private TextView lastnameView;
    private TextView emailView;
    private TextView insuranceView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile);

        firstnameView = (TextView)findViewById(R.id.activity_profile_firstname);
        lastnameView = (TextView)findViewById(R.id.activity_profile_lastname);
        emailView = (TextView)findViewById(R.id.activity_profile_email);
        insuranceView = (TextView)findViewById(R.id.activity_profile_insurance);
    }

    @Override
    protected void onResume() {
        super.onResume();
        Profile profile = MyHealthApplication.getMokkupProfile();
        firstnameView.setText(profile.getFirstname());
        lastnameView.setText(profile.getLastName());
        emailView.setText(profile.getEmail());
        insuranceView.setText(profile.getHealthInsurance());
    }

    public void editProfile(View view)
    {
        Toast.makeText(this,"TODO: edit profile",Toast.LENGTH_SHORT).show();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.main_menu_dashboard) {
            Intent dashBoardIntent = new Intent(this, DashboardActivity.class);
            startActivity(dashBoardIntent);
            return true;
        }
        if (id == R.id.main_menu_profile) {
            Intent profileIntent = new Intent(this,ProfileActivity.class);
            startActivity(profileIntent);
            return true;
        }
        if (id == R.id.main_menu_bills) {
            Intent billsIntent = new Intent(this, BillsActivity.class);
            startActivity(billsIntent);
            return true;
        }
        if (id == R.id.main_menu_pulse) {
            Intent pulseIntent = new Intent(this,PulseActivity.class);
            startActivity(pulseIntent);
            return true;
        }
        if (id == R.id.main_menu_blood_pressure) {
            Intent pressureIntent = new Intent(this,PressureActivity.class);
            startActivity(pressureIntent);
            return true;
        }
        if (id == R.id.main_menu_ecg) {
            Intent ecgIntent = new Intent(this,ECGActivity.class);
            startActivity(ecgIntent);
            return true;
        }
        if (id == R.id.main_menu_urine) {
            Intent urineIntent = new Intent(this,UrineActivity.class);
            startActivity(urineIntent);
            return true;
        }
        if (id == R.id.main_menu_device) {
            Intent deviceIntent = new Intent(this, DeviceActivity.class);
            startActivity(deviceIntent);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
